<template>

  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <span>卡片名称</span>
      <el-button @click="printAccountInfo" style="float: right; padding: 3px 0" type="text">退出</el-button>
    </div>
    <div class="text item">
      {{accountId}}
    </div>
    <div class="text item">
      {{accountName}}
    </div>
    <el-button @click="getInfo" style="float: right; padding: 3px 0" type="text">info</el-button>
  </el-card>
</template>

<script>
import {getAccountName,getAccountId} from '@/utils/account'
import {logout} from "@/api/login/login";
import {getInfo} from "@/api/account/account";
import { ElNotification } from 'element-plus'

export default {
        name: "Mango",
      data(){
          return{
            accountId:'',
            accountName:''
          }
      },
      mounted() {
        this.accountId = getAccountId()
        this.accountName = getAccountName()

      },
      methods:{
          printAccountInfo(){
            logout().then(res => {
              this.$router.push( "/login" ).catch(()=>{});
            }).catch(err => {
              console.log(err)
              ElNotification({
                title: 'Warning',
                message: '登出失败',
                type: 'warning',
              })
            })
          },
        getInfo(){
          getInfo().then(res => {
            console.log(res)
          }).catch(err => {
            console.log(err)
          })
        }
      }
    }
</script>

<style scoped>

</style>